package com.ymttest.database.sqlwapper.shenqisettlement;

import java.util.List;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.shenqisettlement.GoodsOwnerPayment;

public class GoodsOwnerPaymentWrapper {

	SqlManager manager;

    public GoodsOwnerPaymentWrapper() {
        manager = new SqlManager("shenqisettlement");
    }
    
    @SuppressWarnings("unchecked")
	public GoodsOwnerPayment selectByPrimaryKey(Long id) {
    	    	
		List<GoodsOwnerPayment> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqisettlement.GoodsOwnerPaymentMapper.selectByPrimaryKey",
						id);
		manager.commit();

		if (result.size() == 0) {
			Logger.comment("goods_owner_payment没有数据");

			return null;
		}

		return result.get(0);
	}
    
    @SuppressWarnings("unchecked")
	public GoodsOwnerPayment selectByPaymentId(String paymentId) {
    	    	
		List<GoodsOwnerPayment> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqisettlement.GoodsOwnerPaymentMapper.selectByPaymentId",
						paymentId);
		manager.commit();

		if (result.size() == 0) {
			Logger.comment("goods_owner_payment没有数据");

			return null;
		}

		return result.get(0);
	}
    
    @SuppressWarnings("unchecked")
	public List<GoodsOwnerPayment> selectByBillId(Long billId) {
    	    	
		List<GoodsOwnerPayment> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqisettlement.GoodsOwnerPaymentMapper.selectByBillId",
						billId);
		manager.commit();

		if (result.size() == 0) {
			Logger.comment("goods_owner_payment没有数据");

			return null;
		}

		return result;
	}
    
	public int deleteByMerchantId(Long merchantId) {

		int count = manager
				.delete("com.ymttest.database.mapping.shenqisettlement.GoodsOwnerPaymentMapper.deleteByMerchantId",
						merchantId);
		manager.commit();

		return count;
	}
  
    public static void main(String[] args) {
    	
    	GoodsOwnerPaymentWrapper test = new GoodsOwnerPaymentWrapper();
    	
    	System.out.println(test.deleteByMerchantId(500011795L));
    }
}
